function submitForm(){
	var case_levelname=document.getElementById("case_levelname").value;
	if(document.getElementById("case_levelname").value == ""){
		alert("请选择案源级别");
		return false;
	}
	if(document.getElementById("deductions").value == ""){
		alert("请输入应充值的数额");
		return false;
	}
	if(isNaN(document.getElementById("deductions").value)){
		alert("请输入正确的充值金额");
		return false;
	}
	var yes = checkname(case_levelname);
	if(yes){
		document.addForm.submit();
	}
}

function searcher(){
	document.indexForm.submit();	 
}

function checkname(case_levelname){
	var bool = false;
	$.ajax({
		type:"POST",
		async:false,
		url:"checkUserName.jsp",
		data:"case_levelname="+case_levelname,
		success:function(data){
			if(data == 1){
				$("#p_user_name").css("color","red");
				$("#p_user_name").html("案源名已经存在。");
			}else if(data == 0){
				bool = true;
			}
		}
	});
	return bool;
}